/*
 * CheTest.cpp
 *
 *  Created on: 2011-7-31
 *      Author: Administrator
 */

#include "gtest/gtest.h"
#include "../src/RedChe.h"
#include "../src/Situation.h"
#include "../src/RedBing.h"
#include "../src/BlackBing.h"

TEST(CheTest,NoChessInWayActions){
	RedChe che;
	std::vector<Action> actions;
	Position pos(1,2);
	Situation situation;
	situation.AddChess(&che,pos);
	SituationProjection projection;
	situation.GetProjection(projection);
	che.GenActions(actions,pos,projection);
    EXPECT_EQ(17,actions.size());
    EXPECT_EQ(Action(Position(1,2),Position(1,3)),actions[0]);
}


TEST(CheTest,HaveChessInWayActions){
	RedChe che;
	std::vector<Action> actions;
	Position pos(1,2);

	Situation situation;
	situation.AddChess(&che,pos);

	RedBing redbing;
	Position posRedBing(1,3);
	situation.AddChess(&redbing,posRedBing);

	RedBing redbing2;
	Position posRedBing2(1,6);
	situation.AddChess(&redbing2,posRedBing2);

	BlackBing blackbing;
	Position posBlackBing(3,2);
	situation.AddChess(&blackbing,posBlackBing);

	BlackBing blackbing2;
	Position posBlackBing2(6,2);
	situation.AddChess(&blackbing2,posBlackBing2);

	SituationProjection projection;
	situation.GetProjection(projection);
	che.GenActions(actions,pos,projection);
    EXPECT_EQ(5,actions.size());
    EXPECT_EQ(Action(Position(1,2),Position(1,1)),actions[0]);
}


